
{block name="css"}

<link rel="stylesheet" type="text/css" href="__STATIC__/admin/hui/static/h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/hui/static/h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/hui/lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/hui/static/h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/common.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/app.css"/>
{CSS href="__STATIC__/w/admin_base.css" /}
{CSS href="__STATIC__/w/icon.css" /}
{CSS href="__STATIC__/w/layui.css" /}
{CSS href="__STATIC__/w/media_news.css" /}
{CSS href="__STATIC__/w/divtable.css" /}
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/uploadify/uploadify.css">
{/block}

{block name="js"}
{js href='__STATIC__/w/jquery1110min.js' /}
{js href='__STATIC__/w/layui.js' /}
{js href='__STATIC__/w/ajax_file_upload.js' /}
{js href='__STATIC__/admin/hui/lib/layer/2.4/layer.js' /}
<!--上传配置 -->
<script src="__STATIC__/admin/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/upfile.js" type="text/javascript"></script>
<script type="text/javascript">
    upload_image('png');
    upload_image('bg');
    var URL = {
        uploader: '{:url('Upload/image')}',
        swf:'__STATIC__/admin/uploadify/uploadify.swf',
        ROOT:'__PUBLIC__/uploads/image',
    }
</script>
{/block}

{block name="main"}

<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 新版一码一物
    <span class="c-gray en">&gt;</span> 生成二维码
    <a class="btn radius btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>

<form class="layui-form layui-form-cont" action="">

    <div class="layui-form-title">
        生成二维码
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">活动logo</label>
        <div class="layui-input-block">
            <div id="png_s"><img src="__PUBLIC__/uploads/{$data.image ?'image/'.$data.image: 'sm_300.jpg'}" width="200px" height="200px"/></div>
            <input id="png_post" name="logo_img" type="hidden"/>
            <input id="png" name="png_upload" type="file" multiple="true">
            <p class="tip_for_p">提示：logo图片是背景透明的png</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">活动背景图片</label>
        <div class="layui-input-block">
            <div id="bg_s"><img src="__PUBLIC__/uploads/{$data.image ?'image/'.$data.image: 'sm_300.jpg'}" width="200px" height="200px"/></div>
            <input id="bg_post" name="bg_img" type="hidden"/>
            <input id="bg" name="bg_upload" type="file" multiple="true">
            <p class="tip_for_p">提示：活动图片是背景透明的png</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">红包标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" required lay-verify="required" placeholder="红包标题" autocomplete="off" class="layui-input">
            <p class="tip_for_p">提示：红包主题名称，最多填写10个字符，不如：XX公司</p>

        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">红包副标题</label>
        <div class="layui-input-block">
            <input type="text" name="subtitle" required lay-verify="required" placeholder="红包副标题" autocomplete="off" class="layui-input">
            <p class="tip_for_p">提示：打开红包之后，标题下方提示的文字，最多填写7个字符，比如：感谢支持</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">红包金额</label>
        <div class="layui-input-block">
            <input type="number" name="money" required lay-verify="required" placeholder="红包金额" autocomplete="off" class="layui-input">
            <p class="tip_for_p">提示：单位为分，100分=1元，微信规定红包金额最小1元。</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">文本信息</label>
        <div class="layui-input-block">
            <input type="text" name="textmessage" required lay-verify="required" placeholder="文本信息" autocomplete="off" class="layui-input">
            <p class="tip_for_p">提示：可以设置一段文本信息，领取红包之后自动发送这段文本信息给领取红包的微信用户</p>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">红包数量</label>
        <div class="layui-input-block">
            <input type="number" name="num" required lay-verify="required" placeholder="红包数量" autocomplete="off" class="layui-input">
            <p class="tip_for_p">提示：批量生成的红包数量，如果想生成10个微信二维码红包，请输入10</p>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn radius layui-btn-warm">重置</button>
            <button type="button" class="layui-btn radius layui-btn-primary" onClick="window.history.back();">返回上一页</button>
        </div>
    </div>

</form>

<script>
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.load(1);

            // layer.msg(JSON.stringify(data.field));
            $.post('',data.field,function (res) {
                if(res.status=='0'){
                    layer.closeAll('loading');
                    layer.msg(res.msg);
                }
                if(res.status=='1'){
                    layer.closeAll('loading');
                    layer.msg(res.msg);
                    window.location.href=res.url;
                }
            });
            return false;
        });
    });
</script>


{/block}
